<%--
 *  File:    DistributortenderBaseDetailInfo.jsp
 *  @Author: liangchen
 *  Date:    2009-10-10

 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>
<%@ page import="com.oval.util.OvalLabel"%>
<%@ page import="com.oval.util.OvalCustomMessage"%>
<%@ page import="com.oval.util.OvalCustomColumn"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<%
	  //init param
  //String privilegeCode = "H0252";
  String strTableName = "";
  String strModuleName = "CRM";
  	String contextPath = request.getContextPath();
%>

<%@ include file="/inc/PageDefault.inc"%>
<%@include file="/inc/Print.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>


<iframe name="reloadHandler" style="display:none" ></iframe>
<html>
	<head>
		<title>DistributortenderBaseDetailInfo</title>
		
		<PageFlow:CheckPageFlow pageName="p_distributortenderbasedetail" />
		
	<%
    Vector totalsummary = (Vector) pageContext.getAttribute("basedetails");
    if (totalsummary == null)
        totalsummary = new Vector();
    
	Vector propertynames = (Vector) pageContext.getAttribute("propertynames");
	if (propertynames == null)
		propertynames = new Vector();
	
    Vector proddetails = (Vector) pageContext.getAttribute("proddetails");
    if (proddetails == null)
    	proddetails = new Vector();
	
	%>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="<%= contextPath %>/css/<%= strLanguageCode %>/main.css"
			type="text/css">
		<script language="JavaScript"
			src="<%= contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
		<script language="JavaScript" src="<%= contextPath %>/js/FuncLib.js"></script>
		<script language="JavaScript" src="<%= contextPath %>/js/ScriptLib.js"></script>
		<script language="JavaScript" src="<%= contextPath %>/js/keyFunction.js"></script>
		<script language="JavaScript" src="<%= contextPath %>/js/Calendar.js"></script>
		<script language="JavaScript" src="<%= contextPath %>/js/SummaryDivision.js"></script>
		<%@ include file ="/inc/NewCalendar.inc" %>
		<%@ include file="/inc/SummaryDivision.inc"%>
		
		<%
  HashMap userinfo = new HashMap();
  userinfo = (HashMap)session.getAttribute("userinfo");
  Integer orgid=new Integer(-1);
  String neworgid = null;
  if(userinfo.get("orgid")!=null)
  orgid = (Integer)userinfo.get("orgid");
  neworgid = orgid.toString();
    System.out.println("Trace \"isdefault\" ------- detail edit"+pageContext.getAttribute("isdefault"));
    String paraIsDefault = "";
  	String strIsDefault = null;
	if("Y".equals(((String)pageContext.getAttribute("isdefault")))) {
		strIsDefault = "&isdefault=Y";
		paraIsDefault = "Y";
	}else if ("N".equals(((String)pageContext.getAttribute("isdefault")))) {
		strIsDefault = "&isdefault=N";
		paraIsDefault = "N";
	}
		Vector actioninfo = (Vector)(pageContext.getAttribute("actioninfo"));
	%>
	<%
		HashMap newdetailinfo = null;
		if(pageContext.getAttribute("newdetailinfo") != null) { 
			newdetailinfo = (HashMap)(pageContext.getAttribute("newdetailinfo")); 
		}
	%>
	<%
		String isdetail = "";
		if("Y".equals(((String)pageContext.getAttribute("isdetail")))) {
			isdetail = "Y";
		}
		  String isNew = "";
		  if("Y".equals((String)pageContext.getAttribute("isNew"))) {
				isNew = "Y";
			}else if ("N".equals((String)pageContext.getAttribute("isNew"))) {
				isNew = "N";
			}
		    System.out.println("Trace \"isnew\" ------- detail edit"+isNew);
	%>
<script>
function page_summary(actionvalue,orderbyname){
	  var editform = summaryPrepare(actionsummaryform,actionvalue,orderbyname);
	  editform.action = "DistributortenderBaseDetailInfo.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>";
	  editform.target = "_self";
	  isRunning = true;
	  editform.submit();  
}
function ensure() {
	  var editform = document.actionsummaryform;
	  editform.actionname.value = "move";
	  editform.target = "_self";
	  isRunning = true;
	  editform.submit();
	  cancel();
	}
	function page_getitem()
{
    document.actionsummaryform.tenderpropertyid.value='';
    document.actionsummaryform.tenderpropertyname.value='';
    document.actionsummaryform.description.value='';
    document.actionsummaryform.needfeedback.value='';
    
    if(isEmpty(document.actionsummaryform.tenderpropertycode.value))
    {
        return;
    }
    page_handleRequest('<%=contextPath%>',document.actionsummaryform);
}
function page_handleResponse()
{
    document.actionsummaryform.tenderpropertyid.value = getResponseData("tenderpropertyid");
    document.actionsummaryform.tenderpropertyname.value= getResponseData("tenderpropertyname");
   document.actionsummaryform.description.value = getResponseData("description");
   document.actionsummaryform.needfeedback.value = getResponseData("needfeedback");
   document.actionsummaryform.needsku.value= getResponseData("needsku");
   document.actionsummaryform.feedbacktype.value= getResponseData("feedbacktype");
   
  checkdisabled();
}
function page_getitem1(){
	var tenderpropertycode = document.actionsummaryform.tenderpropertycode.value;
	var datahandler = new  DataHandler();
	datahandler.add_params("tenderpropertycode" , tenderpropertycode , "string");
	datahandler.add_params("orgid","<%=orgid%>" , "integer");
	datahandler.getResult("tenderpropertyid","document.actionsummaryform.tenderpropertyid");
	datahandler.getResult("tenderpropertyname","document.actionsummaryform.tenderpropertyname");
	datahandler.getResult("description","document.actionsummaryform.description");
	datahandler.getResult("needfeedback","document.actionsummaryform.needfeedback");
	datahandler.getResult("needsku","document.actionsummaryform.needsku");
	datahandler.getResult("feedbacktype","document.actionsummaryform.feedbacktype");
	datahandler.add_job("j_getactioniteminfo");
	datahandler.runDataHandler();
	datahandler.add_function(checkdisabled());
}
var popwindow;
function page_selectaction()
{
  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('DisPropertyPop.jsp?maxitem=12&languagecode=<%= strLanguageCode%>&<%= OvalTools.randomURL() %>','newwindow', 'height=400, width=850,top=150,left=300,toolbar=n0, menubar=no, scrollbars=auto, resizable=yes, location=no, status=no');
}
         
function page_setactionid(actionid,tenderpropertycode,actionname,description,needprod,valuename,relatedcode)

{
  document.actionsummaryform.tenderpropertyid.value = actionid;
  document.actionsummaryform.tenderpropertycode.value = tenderpropertycode;
  document.actionsummaryform.tenderpropertyname.value = actionname;
  document.actionsummaryform.description.value = description;

  document.actionsummaryform.needprod.value = needprod;
  document.actionsummaryform.valuename.value = valuename;
  document.actionsummaryform.relatedcode.value = relatedcode;
  checkdisabled(needprod);
	
  if (popwindow != null)
    popwindow.close();
}
function checkdisabled() {
	var needprod = document.getElementsByName("needprod");
	
  if(needprod[0].value == "Y") {

  	document.actionsummaryform.needprod.checked = true;

  }
  else if (isEmpty(needprod[0].value )) {
    document.actionsummaryform.needprod.checked = false;
  }
}


function page_back()
{  
  parent.location.href = "DistributortenderSummary.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode%><%=JspHelper.filterNull( strIsDefault)%>";
}


</script>
	</head>
	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

		<form name="actionsummaryform" method="post" action="<%=contextPath %>/Dispatcher">

			<input type="hidden" name="pagename" value="p_distributortenderbasedetail">
			<input type="hidden" name="actionname">   
			<input type="hidden" name="isdefault" value="<%= paraIsDefault %>">
			<input type="hidden" name="isNew" value="<%= isNew %>">	
			<custom:hidden property="distributortenderid" />
			<table width="100%" cellspacing="0" cellpadding="0" border="0">
               <%
				String distributortenderid = null;
				distributortenderid = (pageContext.getAttribute("distributortenderid")).toString(); 
				%>

<% if(totalsummary.size()>0){%>				
				 <tr>
			        <td>          
			          <table width="100%" border="0" cellspacing="0">           
			            <tr><td class="summary_top"></td></tr>
			            <tr><td ><%=label.getLabelName("L_BasicInfo")%><%=label.getLabelName("L_Colon")%></td></tr>            
			          </table>
			        </td>
			    </tr>
				<tr>
					<td>
						<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
						 <%
				            int num=0;
							String strCheck="";
							String activitybasedetailidstr=null;
							String tenderpropertyidstr=null;
				            for(int i=0;i<totalsummary.size();i++)
				            {
				            	HashMap tempMap=(HashMap)totalsummary.get(i);
				           		Integer propertyID=(Integer)tempMap.get("tenderpropertyid");
				           		tenderpropertyidstr=propertyID.toString();
				           		Integer odetailtype=(Integer)tempMap.get("contenttype");
				           		String texts=(String)tempMap.get("detailtext");
				           		String checks=(String)tempMap.get("detailcheck");
								if("Y".equals(tempMap.get("detailcheck"))){
								strCheck="checked";}
								pageContext.setAttribute("basehash",tempMap);
				                Integer idxnum=new Integer(num);
				           %>
			<% if (num % 2 == 0){%>
             <tr > 
             <%}%>
          			<td width="10%"><%=tempMap.get("tenderpropertyname")%></td>
          			<td width="40%">
          			<input type="hidden"  name="distributortenderid<%=num%>" value="<%=distributortenderid%>" />
					<input type="hidden" name="tenderconfigdetailid<%=num%>"  value="<%=tenderpropertyidstr%>" />
					<input type="hidden" name="tenderbasedetailid<%=num%>" value="<%=tempMap.get("tenderbasedetailid")%>"/>
					<%
					if(odetailtype.intValue()==1){
					%>
					<custom:write property="detailnumber" name="basehash"  nbsp="true"/>
					<custom:hidden  name="basehash"  property="detailtype"  colIndex="<%=idxnum%>" value="1"/>
					<%}else if(odetailtype.intValue()==2){%>
					<custom:write name="basehash" property="detailtext" nbsp="true"/>
					<custom:hidden  name="basehash"  property="detailtype"  colIndex="<%=idxnum%>" value="1"/>
					<%}else if(odetailtype.intValue()==6){ %>
					<custom:hidden  name="basehash"  property="detailtype"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write property="detaildate"  dataType="date"  name="basehash" nbsp="true"/>
					<a onclick="javascript:c.show(this,'actionsummaryform.detaildate<%=idxnum %>','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
					<%}else if(odetailtype.intValue()==8){
	          			   String oSourcetype=(String)tempMap.get("sourcetype");
	          				Vector vBasefeedbacktypes=(Vector)pageContext.getAttribute("propertydetails");	
	          				if(vBasefeedbacktypes==null)
	          					vBasefeedbacktypes=new Vector();
	          				HashMap oneBaseFeedtype=new HashMap();
	          				int base=0;
	          			    if(vBasefeedbacktypes !=null){
	          			     for(int sj=0;sj<vBasefeedbacktypes.size();sj++){
	          			    	HashMap actionMap=(HashMap)vBasefeedbacktypes.get(sj);
	          			     if(actionMap.get("stype").equals(oSourcetype)){
	          			     %>
	          			     <input type="checkbox" name="basevalues<%=tenderpropertyidstr %>" id="baseids_<%=tenderpropertyidstr+"_"+((HashMap)vBasefeedbacktypes.get(sj)).get("typevalue")%>" value="<%=((HashMap)vBasefeedbacktypes.get(sj)).get("typevalue") %>" class="normalradio" disabled/>
	          			     
	          			     <%=((HashMap)vBasefeedbacktypes.get(sj)).get("sourcetypename") %>
	          			     <% if(base %5 ==0 && base!=0){ %>
	          			      <br>
	          			     <%} %>
	          			     <% 
	          			        oneBaseFeedtype.put(((HashMap)vBasefeedbacktypes.get(sj)).get("typevalue"),((HashMap)vBasefeedbacktypes.get(sj)).get("sourcetypename"));  
	          			          base++;
	          			    	 }
	          			     }
	          			    }%>
	          			    <custom:hidden  name="basehash"  property="detailchoose"   colIndex="<%=idxnum%>"/>
					<%
					}else{
					%>
					<input type="checkbox" name="sdetailcheck<%=idxnum %>" <%=strCheck%> class="normalradio" disabled/>
          			<custom:hidden  name="basehash"  property="detailcheck"  colIndex="<%=idxnum%>"/>
					<%} %>
					</td>
          	<% if (num % 2 == 1){%>
          	</tr>
          	<%}%>
          	<%
          	num++;
          	}%>
          </table>
         </td>
       </tr>  
       
     
       
        <%if(propertynames.size()>0){ %>

	 <tr>
        <td>          
          <table width="100%" border="0" cellspacing="0">           
            <tr><td class="summary_top"></td></tr>
            <tr><td ><%=label.getLabelName("L_ProductFeedbackInfo")%><%=label.getLabelName("L_Colon")%></td></tr>            
          </table>
        </td>
      </tr>

	<tr>
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
              <tr class="deepblue-left">
	         		<td class="title_center"><%=label.getLabelName("L_ProdName")%></td>
         	<%
            for(int i=0;i<propertynames.size();i++)
            {
            	HashMap nameMap=(HashMap)propertynames.get(i);
         	%>
         			<td class="title_center"><%=nameMap.get("tenderpropertyname")%></td>	
            <%
            }
           %> 
         	 </tr>
         	 <tr>
            <%
            
            Vector prdndetails = (Vector)pageContext.getAttribute("prdndetails");
            if (prdndetails == null)
            	prdndetails = new Vector();
			
            for(int j=0;j<prdndetails.size();j++)
            {
            	HashMap actionMap1=(HashMap)prdndetails.get(j);
           		Integer detailID=(Integer)actionMap1.get("prodid");
			
	        %> 
	        <td><%=actionMap1.get("prdn")%></td>
	        <%
			String strCheck1="";
            for(int a=0;a<proddetails.size();a++)
            {
            	HashMap prodMap=(HashMap)proddetails.get(a);
           		Integer idxnum=new Integer(num);
           		Integer propertyID=(Integer)prodMap.get("tenderpropertyid");
           		tenderpropertyidstr=propertyID.toString();
           		Integer odetailtype=(Integer)prodMap.get("contenttype");
           		Integer detailNumber=(Integer)prodMap.get("prodid");
           		if(prodMap.get("prodid")==null){
           			detailNumber=detailID;
           		}
           		Integer detailNumber11=(Integer)prodMap.get("tenderbasedetailprodid");
				strCheck1="checked";
				pageContext.setAttribute("prodhash",prodMap);
				if(detailNumber==null){
            %>
			        <td>
          			<input type="hidden"  name="distributortenderid<%=num%>" value="<%=distributortenderid%>" />
          			<input type="hidden"  name="prodid<%=num%>" value="<%=String.valueOf((Integer)actionMap1.get("prodid"))%>" />
					<input type="hidden" name="tenderpropertyid<%=num%>"  value="<%=tenderpropertyidstr%>" />
					<input type="hidden" name="tenderbasedetailprodid<%=num%>" value="<%=prodMap.get("tenderbasedetailprodid")%>"/>
					<%if(odetailtype.intValue()==1){%>
					<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write property="detailnumber" name="prodhash"  nbsp="true"/>
					<%}else if(odetailtype.intValue()==2){%>
					<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write name="prodhash" property="detailtext" nbsp="true"/>
					<%}else if(odetailtype.intValue()==6){ %>
					<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write property="detaildate"   dataType="date"   name="prodhash" nbsp="true"/>
					<a onclick="javascript:c.show(this,'actionsummaryform.detaildate<%=idxnum %>','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
					<%}else if(odetailtype.intValue()==8){
	          			   String oSourcetype=(String)prodMap.get("sourcetype");
	          				Vector Prodfeedbacktypes=(Vector)pageContext.getAttribute("prodpropertydetails");	
	          				if(Prodfeedbacktypes==null)
	          					Prodfeedbacktypes=new Vector();
	          				HashMap prodBaseFeedtype=new HashMap();
	          				int base=0;
	          			    if(Prodfeedbacktypes !=null){
	          			     for(int sj=0;sj<Prodfeedbacktypes.size();sj++){
	          			    	HashMap pactionMap=(HashMap)Prodfeedbacktypes.get(sj);
	          			     if(pactionMap.get("type").equals(oSourcetype)){
	          			     %>
	          			     <input type="checkbox" name="prodvalues<%=tenderpropertyidstr%>" id="prodids_<%=tenderpropertyidstr+"_"+((HashMap)Prodfeedbacktypes.get(sj)).get("value")+"_"+(String.valueOf((Integer)actionMap1.get("prodid")))+"_"+prodMap.get("tenderbasedetailprodid")%>" value="<%=((HashMap)Prodfeedbacktypes.get(sj)).get("value") %>" class="normalradio" disabled/>
	          			     
	          			     <%=((HashMap)Prodfeedbacktypes.get(sj)).get("sourcetypename")%>
	          			     <% if(base %5 ==0 && base!=0){ %>
	          			      <br>
	          			     <%} %>
	          			     <% 
	          			          prodBaseFeedtype.put(((HashMap)Prodfeedbacktypes.get(sj)).get("value"),((HashMap)Prodfeedbacktypes.get(sj)).get("sourcetypename"));  
	          			          base++;
	          			    	 }
	          			     }
	          			    }%>
	          			    <custom:hidden  name="prodhash"  property="detailchoose"   colIndex="<%=idxnum%>"/>
	          			    
					<%}else{%>
					<input type="checkbox" name="sdetailcheck<%=idxnum %>" value="Y" <%=strCheck1%> class="normalradio" disabled/>
          			<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>"/>
					<%} %>
					</td>
					<%}else if(detailNumber!=null && detailID.intValue()==detailNumber.intValue()){%>
			        <td>
          			<input type="hidden"  name="distributortenderid<%=num%>" value="<%=distributortenderid%>" />
          			<input type="hidden"  name="prodid<%=num%>" value="<%=String.valueOf((Integer)actionMap1.get("prodid"))%>" />
					<input type="hidden" name="tenderpropertyid<%=num%>"  value="<%=tenderpropertyidstr%>" />
					<input type="hidden" name="tenderbasedetailprodid<%=num%>" value="<%=prodMap.get("tenderbasedetailprodid")%>"/>
					<%if(odetailtype.intValue()==1){%>
					<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write property="detailnumber" name="prodhash" nbsp="true"/>
					<%}else if(odetailtype.intValue()==2){%>
					<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write name="prodhash" property="detailtext" nbsp="true"/>
					<%}else if(odetailtype.intValue()==6){ %>
					<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>" value="1"/>
					<custom:write property="detaildate" dataType="date"  name="prodhash" nbsp="true"/>
					<a onclick="javascript:c.show(this,'actionsummaryform.detaildate<%=idxnum %>','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
					<%}else if(odetailtype.intValue()==8){
	          			   String oSourcetype=(String)prodMap.get("sourcetype");
	          				Vector Prodfeedbacktypes=(Vector)pageContext.getAttribute("prodpropertydetails");	
	          				if(Prodfeedbacktypes==null)
	          					Prodfeedbacktypes=new Vector();
	          				HashMap prodBaseFeedtype=new HashMap();
	          				int base=0;
	          			    if(Prodfeedbacktypes !=null){
	          			     for(int sj=0;sj<Prodfeedbacktypes.size();sj++){
	          			    	HashMap pactionMap=(HashMap)Prodfeedbacktypes.get(sj);
	          			     if(pactionMap.get("type").equals(oSourcetype)){
	          			     %>
	          			     <input type="checkbox" name="prodvalues<%=tenderpropertyidstr%>" id="prodids_<%=tenderpropertyidstr+"_"+((HashMap)Prodfeedbacktypes.get(sj)).get("value")+"_"+(String.valueOf((Integer)actionMap1.get("prodid")))+"_"+prodMap.get("tenderbasedetailprodid")%>" value="<%=((HashMap)Prodfeedbacktypes.get(sj)).get("value") %>" class="normalradio" disabled/>
	          			     
	          			     <%=((HashMap)Prodfeedbacktypes.get(sj)).get("sourcetypename")%>
	          			     <% if(base %5 ==0 && base!=0){ %>
	          			      <br>
	          			     <%} %>
	          			     <% 
	          			   		  prodBaseFeedtype.put(((HashMap)Prodfeedbacktypes.get(sj)).get("value"),((HashMap)Prodfeedbacktypes.get(sj)).get("sourcetypename"));  
	          			          base++;
	          			    	 }
	          			     }
	          			    }%>
	          			    <custom:hidden  name="prodhash"  property="detailchoose"   colIndex="<%=idxnum%>"/>
	          			    
					<%}else{%>
							<input type="checkbox" name="sdetailcheck<%=idxnum %>" value="Y" <%=strCheck1%> class="normalradio" disabled/>
	          				<custom:hidden  name="prodhash"  property="detailcheck"  colIndex="<%=idxnum%>"/>
					<%} %>
					</td>
					<%
					if(detailID.intValue()==detailNumber.intValue()){
					  num++;
					}}else{ %>
					<%} %>
					<%} %>
					</tr>
          	<%
          	}%>
          </table>
         </td>
       </tr> 
       
      <%} %> 
       
       
       <input type="hidden" name="numrows" value="<%=num%>"/>		
       
							<%@ include file="/inc/SummaryAction.inc"%>
						</table>
  <%} %>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td class="summary_top"></td>
							</tr>
							<tr>
								<td class="td_center">
									<input type="hidden" name="isdetail" value="<%= isdetail%>">
									<!-- 
									<%if(totalsummary.size()>0){ %>				
									<a onclick='page_add()'><custom:button type="1" label="L_Save" imgsrc="finish.gif" border="0" style="width:60" /></a>
									<%} %>
									 -->
									<a onclick="page_back();"><custom:button type="1" label="L_Back" border="0"  imgsrc="finish.gif" style="width:60" /></a>
								</td>
							</tr>
						</table>
			
		</form>
	
	<script>

function page_add(){

		var myform = eval("document.actionsummaryform");
		for(i=0;i<Number(myform.numrows.value);i++)
		{
			var objscheck=eval("myform.sdetailcheck"+i);
			var objcheck=eval("myform.detailcheck"+i);
			if(objscheck!=null && objscheck.checked)
			{
				objcheck.value="Y";
			}
			else if(objscheck!=null && !objscheck.checked)
			{
				objcheck.value=" ";
			}
			
			var objnumber=eval("myform.detailnumber"+i);
			if(objnumber!=null && !isNumeric(objnumber.value))
			{
				alert("<%= message.getMessageDesc("VALUE_MUST_BE_NUMBER_TYPE",label.getLabelName("L_TenderTypeValue"))%>");
				return;
			}
				
		}



		//基本信息的多选

<%
		 int vseq=0;
for(int a=0;a<totalsummary.size();a++){
	      HashMap vactionMap=(HashMap)totalsummary.get(a);
	      if(vactionMap==null)vactionMap=new HashMap();
	      
	      Integer voFeedbacktype=(Integer)vactionMap.get("contenttype");
	      Vector Basefeedbacktypes=(Vector)pageContext.getAttribute("propertydetails");	
		  if(Basefeedbacktypes==null)Basefeedbacktypes=new Vector();
		    
	      if(voFeedbacktype.intValue()==8){	
	     	     String voSourcetype=(String)vactionMap.get("sourcetype");
	     	     int x=0;
	     	     int xu=0;
	   %>
	   var feedbackmultiselecttemp="";
	   <%
			for(int b=0;b<Basefeedbacktypes.size();b++){
				    	 if((((HashMap)Basefeedbacktypes.get(b)).get("stype")).equals(voSourcetype)){
	   %>
	     if(<%=xu%>==0){
	       document.getElementById("detailchoose"+<%=vseq%>).value=" ";
	     }
	     if(document.getElementById("baseids_"+<%=(Integer)vactionMap.get("tenderpropertyid") %>+"_"+<%=((HashMap)Basefeedbacktypes.get(b)).get("typevalue")%>).checked){

	         if(!isEmpty(document.getElementById("detailchoose"+<%=vseq%>).value)){
	            feedbackmultiselecttemp=feedbackmultiselecttemp+document.getElementById("baseids_"+<%=(Integer)vactionMap.get("tenderpropertyid") %>+"_"+<%=((HashMap)Basefeedbacktypes.get(b)).get("typevalue")%>).value+",";
	          }else{
	            feedbackmultiselecttemp="";
	            feedbackmultiselecttemp=document.getElementById("baseids_"+<%=(Integer)vactionMap.get("tenderpropertyid") %>+"_"+<%=((HashMap)Basefeedbacktypes.get(b)).get("typevalue")%>).value+",";
	          }
	          document.getElementById("detailchoose"+<%=vseq%>).value=feedbackmultiselecttemp.substring(0,feedbackmultiselecttemp.length-1);
	     } 
	   <%         x++; 
	              xu++;
				    	 } 
				     }
			   }
	      vseq++;
	  }
%>




		//产品反馈信息多选
		<%
int vpseq=totalsummary.size();
       	Vector prdndetails = (Vector) pageContext.getAttribute("prdndetails");
       	if (prdndetails == null)
       	prdndetails = new Vector();
for(int j=0;j<prdndetails.size();j++)
    {
        HashMap actionMap1=(HashMap)prdndetails.get(j);
       	Integer detailID=(Integer)actionMap1.get("prodid");
   for(int i=0;i<proddetails.size();i++)
	     {
	            HashMap prodMap=(HashMap)proddetails.get(i);
	       		Integer detailNumber=(Integer)prodMap.get("prodid");
           		if(prodMap.get("prodid")==null){
           			detailNumber=detailID;
           		}
	       	    Integer propertyID=(Integer)prodMap.get("tenderpropertyid");
	       		Integer detailNumber111=(Integer)prodMap.get("tenderbasedetailprodid");
	       		Integer vpFeedbacktype=(Integer)prodMap.get("contenttype");
	if(vpFeedbacktype.intValue()==8){	
		     	     String voSourcetype=(String)prodMap.get("sourcetype");
		     	     int xp=0;
		     	     int xm=0;
	   %>
	   var feedbackmultiselecttempprod="";
	   <%
  				Vector Prodfeedbacktypes=(Vector)pageContext.getAttribute("prodpropertydetails");	
  				if(Prodfeedbacktypes==null)
  					Prodfeedbacktypes=new Vector();
  				
  for(int bi=0;bi<Prodfeedbacktypes.size();bi++){
    if((((HashMap)Prodfeedbacktypes.get(bi)).get("type")).equals(voSourcetype)){
    	if(detailNumber!=null && detailID.intValue()==detailNumber.intValue()){
    	    %>
    	     if(<%=xm%>==0){
    	       document.getElementById("detailchoose"+<%=vpseq%>).value=" ";
    	     }
    	     if(document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=((HashMap)Prodfeedbacktypes.get(bi)).get("value")%>+"_"+<%=detailID%>+"_"+<%=(Integer)prodMap.get("tenderbasedetailprodid")%>).checked){

    	          if(!isEmpty(document.getElementById("detailchoose"+<%=vpseq%>).value)){
    	        	 feedbackmultiselecttempprod=feedbackmultiselecttempprod+document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=((HashMap)Prodfeedbacktypes.get(bi)).get("value")%>+"_"+<%=detailID%>+"_"+<%=(Integer)prodMap.get("tenderbasedetailprodid")%>).value+",";
    	          }else{
    	        	  feedbackmultiselecttempprod="";
    	        	  feedbackmultiselecttempprod=document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=((HashMap)Prodfeedbacktypes.get(bi)).get("value")%>+"_"+<%=detailID%>+"_"+<%=(Integer)prodMap.get("tenderbasedetailprodid")%>).value+",";
    	          }
    	          document.getElementById("detailchoose"+<%=vpseq%>).value=feedbackmultiselecttempprod.substring(0,feedbackmultiselecttempprod.length-1);
    	          } 
    		<%}else if(detailNumber==null) {
    		%>
    	     if(<%=xm%>==0){
    	       document.getElementById("detailchoose"+<%=vpseq%>).value=" ";
    	     }
    	     if(document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=((HashMap)Prodfeedbacktypes.get(bi)).get("value")%>+"_"+<%=detailID%>+"_"+<%=(Integer)prodMap.get("tenderbasedetailprodid")%>).checked){
    	         if(!isEmpty(document.getElementById("detailchoose"+<%=vpseq%>).value)){
    	        	 feedbackmultiselecttempprod=feedbackmultiselecttempprod+document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=((HashMap)Prodfeedbacktypes.get(bi)).get("value")%>+"_"+<%=detailID%>+"_"+<%=(Integer)prodMap.get("tenderbasedetailprodid")%>).value+",";
    	          }else{
    	        	  feedbackmultiselecttempprod="";
    	        	  feedbackmultiselecttempprod=document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=((HashMap)Prodfeedbacktypes.get(bi)).get("value")%>+"_"+<%=detailID%>+"_"+<%=(Integer)prodMap.get("tenderbasedetailprodid")%>).value+",";
    	          }
    	          document.getElementById("detailchoose"+<%=vpseq%>).value=feedbackmultiselecttempprod.substring(0,feedbackmultiselecttempprod.length-1);
    	          }
    		<%
    		}%>  
	     <%         
	     xm++;   
	 } 
   }  
 }
    if(detailID.intValue()==detailNumber.intValue()){
	 vpseq++;    
    }   
  }
}
%>

	   var frm = document.actionsummaryform;
	   frm.actionname.value = "save";
	   frm.target = "_self";
	   isRunning = true;
	   frm.submit();

  }
	</script>
	
	<script>
	
	//基本信息多选展示
<%
    	int zseq=0;
for(int i=0;i<totalsummary.size();i++){
		 HashMap zactionMap=(HashMap)totalsummary.get(i);
        if(zactionMap==null)zactionMap=new HashMap();
        
        Integer zoFeedbacktype=(Integer)zactionMap.get("contenttype");
        if(zoFeedbacktype.intValue()==8){	
       	String zFeedbackmultiselect=(String)zactionMap.get("detailchoose");
       	if(zFeedbackmultiselect !=null){
       	 String[] ss = zFeedbackmultiselect.split(","); 
     for(int s=0;s<ss.length;s++){
         %>
           document.getElementById("baseids_"+<%=(Integer)zactionMap.get("tenderpropertyid") %>+"_"+<%=(Integer.valueOf(ss[s])).intValue()%>).checked=true;
         <%
       	 		}
       		}
        }
	}

%>



		//产品反馈信息多选展示
<%
	    int zpseq=totalsummary.size();
for(int j=0;j<prdndetails.size();j++)
	    {
	    	HashMap actionMap1=(HashMap)prdndetails.get(j);
	   		Integer detailID=(Integer)actionMap1.get("prodid");
	   		
	for(int p=0;p<proddetails.size();p++){
			HashMap pactionMap=(HashMap)proddetails.get(p);
	        if(pactionMap==null)pactionMap=new HashMap();
	        
	        Integer zpFeedbacktype=(Integer)pactionMap.get("contenttype");
	        Integer detailNumber=(Integer)pactionMap.get("prodid");
	        Integer propertyID=(Integer)pactionMap.get("tenderpropertyid");
	        if(zpFeedbacktype.intValue()==8){	
	       	String zpFeedbackmultiselect=(String)pactionMap.get("detailchoose");
	       	if(zpFeedbackmultiselect !=null){
	       	 String[] sp = zpFeedbackmultiselect.split(","); 
	     for(int s1=0;s1<sp.length;s1++){
	       		if(detailNumber!=null && detailID.intValue()==detailNumber.intValue()){
	         %>
	           document.getElementById("prodids_"+<%=propertyID%>+"_"+<%=(Integer.valueOf(sp[s1])).intValue()%>+"_"+<%=detailID%>+"_"+<%=(Integer)pactionMap.get("tenderbasedetailprodid")%>).checked=true;
	         <%
	       	 		}
	       		}
	        }
	    }
	}
}
		 %>
	
	
	</script>
	</body>
</html>


